import request from '@/utils/request'

    /** 获取全部文件类型 */
    export function getFileType(params) {
      return request({
        url: '/assessDataMessage/dataManage/dataLoad/getFileType',
        method: 'get',
        params: params
      })
    }
    /** 点击文件名称 显示列表 */
    export function getRecordList(params){
      return request({
        url: '/assessDataMessage/dataManage/dataLoad/getRecordList',
        method: 'get',
        params: params
      })
    }
    /** 列表-设置 */
    export function getSetInfo(params){
      return request({
        url: '/assessDataMessage/dataManage/dataLoad/getSetInfo',
        method: 'get',
        params: params
      })
    }
    /** 列表-加载 */
    export function loadTableData(params){
      return request({
        url: '/assessDataMessage/dataManage/dataLoad/loadTableData',
        method: 'post',
        data: params
      })
    }
    /** 列表-删除 */
    export function deleteData(params){
      return request({
        url: '/assessDataMessage/dataManage/dataLoad/deleteData',
        method: 'get',
        params: params
      })
    }
    /** 列表-删除 */
    /*downloadTemplate(params){
        return request.get(getTempStr(`/assessDataMessage/common/download/template`,params), params)
    },*/
    /** 列表-上传文件 */
    export function uploadingFile(params){
      return request({
        url: '/assessDataMessage/dataManage/dataLoad/uploadingFile',
        method: 'post',
        params: params
      })
    }
    /** 列表-加载 */
    export function  updateInfo(params){
      return request({
        url: '/assessDataMessage/dataManage/dataLoad/updateInfo',
        method: 'post',
        data: params
      })
    }



    /**
     * 数据管理 数据维护 导出
     */
    export function downloadTemplate(params) {
        return toGetUrl(
            `/assessDataMessage/dataManage/dataLoad/downloadTemplate`,
            params
        );

      this.download('/fastloader/uploader/download',
        params
        , row.filename);
    }

    function toGetUrl(url, params) {
        return (
            (process.env.VUE_APP_BASE_API.length>1?process.env.VUE_APP_BASE_API:"") +
          url +
          "?" +
          Object.keys(params)
            .flatMap((item) => (params[item] ? [`${item}=${params[item]}`] : []))
            .join("&")
        );
    }




